package com.sinodata.bsm.common.vo;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * ResView entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "RES_VIEW")
public class ResView implements java.io.Serializable, Comparable {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 2074091782967792186L;

    // Fields  
    private Long id;
    private String name;
    private Integer expandLevel;

    // Constructors

    /** default constructor */
    public ResView() {
    }

    /** minimal constructor */
    public ResView(Long id) {
        this.id = id;
    }

    // Property accessors
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequence")
    @SequenceGenerator(name = "sequence", sequenceName = "RES_VIEW_SEQ")
    @Column(name = "ID", unique = true, nullable = false, precision = 18, scale = 0)
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "NAME", length = 64)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "EXPAND_LEVEL", precision = 1, scale = 0)
    public Integer getExpandLevel() {
        return this.expandLevel;
    }

    public void setExpandLevel(Integer expandLevel) {
        this.expandLevel = expandLevel;
    }

    @Override
    public String toString() {
        return "ResView [id=" + id + ", name=" + name + ", expandLevel=" + expandLevel + "]";
    }

    @Override
    public int compareTo(Object o) {
        ResView anotherResView = (ResView) o;
        long l = this.id.longValue() - anotherResView.id.longValue();
        return l > 0 ? 1 : (l == 0 ? 0 : -1);
    }

}